
<!--注册页面-->
<!DOCTYPE html>
<html>
<head>
    <title>酒店注册界面</title>
    <link rel="stylesheet" href="CSS/register.css" type="text/css">
    <meta charset="UTF-8">
</head>

<body style="background: url(images/p5.png);background-repeat:no-repeat; background-size: 100% 100%;">
      <div class="welcome">
          <h1 class="tips">用户注册</h1>
      </div>
      <div class="Registerbox">
<!--数据交互-->
          <form name="register">
              <input type="text" class="num"  placeholder="账 号" name="CM_ID" id="CM_ID"><br>
              <input type="password" class="pwd" placeholder="密 码" name="CM_PWD" id="CM_PWD"><br>

              <select class="num" name="CM_IDNUMBER" id="CM_IDNUMBER">
                  <option value="30">身份证</option>
                  <option value="31">护照</option>
                  <option value="32">无</option>
              </select>
              <input type="text" placeholder="证件号码" name="CM_PAPERNUMBER" id="CM_PAPERNUMBER">
              <select class="num" name="CM_CUL" id="CM_CUL">
                  <option value="33">小学</option>
                  <option value="34">初中</option>
                  <option value="34">高中</option>
                  <option value="35">大学</option>
              </select>
              <select class="num" name="CM_SEX" id="CM_SEX">
                  <option value="22">男</option>
                  <option value="23">女</option>
              </select>
              <select class="num" name="CM_NATION" id="CM_NATION">
                  <option value="24">汉族</option>
                  <option value="25">回族</option>
                  <option value="26">维吾尔族</option>
                  <option value="27">苗族</option>
                  <option value="28">壮族</option>
                  <option value="29">其他</option>
              </select>
              <select class="num" name="CM_THINGREASON" id="CM_THINGREASON">
                  <option value="37">出差</option>
                  <option value="38">旅游</option>
                  <option value="39">其他</option>
              </select>
              <input type="text" class="num" placeholder="姓名" name="CM_NAME" id="CM_NAME">
              <input type="date" class="num" name="CM_BIRTH" id="CM_BIRTH">
              <input type="text" class="num" placeholder="住址" name="CM_ADDRESS" id="CM_ADDRESS">
              <input type="text" class="num" placeholder="职业" name="CM_JOB" id="CM_JOB">
              <input type="text" class="num" placeholder="电话号码" name="CM_PHONE" id="CM_PHONE">
              <input type="text" class="num" placeholder="备注" name="CM_TIPS" id="CM_TIPS">
              <input type="button" class="btn" value="注册" name="regbtn"><br>
          </form>
      </div>
<script src="js/axios-0.18.0.js"></script>
<script>

    window.onload=function (){
        const regbtn = document.querySelector("input[name='regbtn']");
        regbtn.onclick=function (){
            var CM_ID=document.getElementById("CM_ID").value;
            var CM_PWD=document.getElementById("CM_PWD").value;
            var CM_CUL=document.getElementById("CM_CUL").value;
            var CM_SEX=document.getElementById("CM_SEX").value;
            var CM_NATION=document.getElementById("CM_NATION").value;
            var CM_THINGREASON=document.getElementById("CM_THINGREASON").value;
            var CM_NAME=document.getElementById("CM_NAME").value;
            var CM_BIRTH=document.getElementById("CM_BIRTH").value;
            var CM_ADDRESS=document.getElementById("CM_ADDRESS").value;
            var CM_PHONE=document.getElementById("CM_PHONE").value;
            var CM_JOB=document.getElementById("CM_JOB").value;
            var CM_IDNUMBER=document.getElementById("CM_IDNUMBER").value;
            var CM_PAPERNUMBER=document.getElementById("CM_PAPERNUMBER").value;
            var data1={
                "id": CM_ID,
                "pwd":CM_PWD,
                "papersID":CM_IDNUMBER,
                "CM_PAPERNUMBER":CM_PAPERNUMBER,
                "educationDegreeID":CM_CUL,
                "genderID":CM_SEX,
                "nationID":CM_NATION,
                "thingReasonID":CM_THINGREASON,
                "name":CM_NAME,
                "papersNumber":CM_IDNUMBER,
                "birthDate":CM_BIRTH,
                "unitsOrAddress":CM_ADDRESS,
                "profession":CM_JOB,
                "contactPhoneNumber":CM_PHONE
            }

            console.log(data1);


            axios({
                method: 'post',
                url: '/ConsumerController',
                data: data1

            }).then(function (resp) {
                if (resp.data.data==true){
                    alert("注册成功！");
                    window.location.href="Login_Custom.html"
                }else {
                    alert("注册失败!");
                }
            });
        }
    }



</script>

</body>

</html>
